package com.gxa.j259.springcloud.f.feign.controller;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author thinknovo
 * @version 1.0
 */
@RestController
public class FeignController {
    @Resource
    private ServiceFeignByCheck serviceFeignByCheck;
    /*
    这里类似于ribbon，提供一个对外访问的接口地址，
    然后根据serviceFeignByCheck接口来决定调用哪一个子模块服务和哪一个接口地址
     */
    @RequestMapping(value = "/check",method = RequestMethod.GET,
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Map check(String name) {
        System.out.println("name=" + name);
        return serviceFeignByCheck.selectClient(name);
    }
}
